SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[TvShow_Insert_New]
@ShowName VARCHAR(150), @Description VARCHAR(MAX), @Episodes INT, @Rating FLOAT, @FirstAired varchar(20),
@BannerImage VARCHAR(MAX), @Status VARCHAR(50)
AS
IF NOT EXISTS(SELECT Title FROM Tv WHERE Title = @ShowName)
BEGIN 
	INSERT INTO dbo.Tv
			( 
			  Title ,
			  [Description],
			  Rating ,
			  Episodes ,
			  ReleaseDate,
			  BannerImage,
			  [Status]
			)
	VALUES  ( 
			  @ShowName , -- Title - varchar(200)
			  @Description , -- Description - varchar(max)
			  @Rating , -- Rating - float
			  @Episodes , -- Episodes - int
			  @FirstAired,  -- ReleaseDate - varchar(50)
			  @BannerImage,
			  @Status
			)
END   
Select MAX(Id) AS Id From Tv
GO
